<template>
    <div class="p-15 p-t-0">
        <div class="table-padding orderDialog materia-costs-con">
            <el-form :model="modelForm" ref="modelForm" class="relationship_form">
                <div class="text-left">
                    <el-row :gutter="24">
                        <el-col :span="8">
                            <!--rules.numPot-->
                            <el-form-item prop="processQty" :rules="[]">
                                <el-input placeholder="成品编码" v-model="product.no" :disabled="noEdit" size="medium">
                                    <template slot="prepend">
                                        <el-tooltip placement="top" content="成品编码">
                                            <el-button>成品编码</el-button>
                                        </el-tooltip>
                                    </template>
                                </el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <el-form-item prop="name" :rules="[]" >
                                <el-input placeholder="成品名称" v-model="product.name" :disabled="noEdit" size="medium">
                                    <template slot="prepend">
                                        <el-tooltip placement="top" content="成品名称">
                                            <el-button>成品名称</el-button>
                                        </el-tooltip>
                                    </template>
                                </el-input>
                            </el-form-item>
                        </el-col>
                        <el-col :span="8">
                            <!--rules.numPot-->
                            <el-form-item prop="processQty" :rules="[]">
                                <el-input placeholder="成品规格" v-model="product.goodsSpec" :disabled="noEdit" size="medium">
                                    <template slot="prepend">
                                        <el-tooltip placement="top" content="成品规格">
                                            <el-button>成品规格</el-button>
                                        </el-tooltip>
                                    </template>
                                </el-input>
                            </el-form-item>
                        </el-col>

                    </el-row>
                    <!--<el-form-item prop="no" :rules="[]">-->
                    <!--<el-input type="text" v-model="modelForm.remark" auto-complete="off" placeholder="请输入备注信息">-->
                    <!--<template slot="prepend">-->
                    <!--<el-button>备注</el-button>-->
                    <!--</template>-->
                    <!--</el-input>-->
                    <!--</el-form-item>-->
                </div>
                <div class="materialCostTable">
                    <el-form-item class="text-left">
                        <el-button size="medium" type="primary" @click="submitForm('modelForm')" v-if="$route.query.type!=1"><i class="icon icon-baocun"></i> 保存</el-button>
                        <el-button size="medium" type="danger" @click="goBack()"><i class="icon icon-fanhui1"></i> 取消</el-button>
                    </el-form-item>
                    <!-- show-summary
                                                    :summary-method="getSummaries" -->
                    <div class="center-center">
                        <el-table
                                :data="tableData"
                                border
                                style="position: relative">
                            <el-table-column
                                    type="index"
                                    width="50">
                            </el-table-column>
                            <el-table-column
                                    width="80">
                                <template scope="scope">
                                    <span class="el-icon-plus" style="cursor: pointer;font-size: 10px;padding-right: 5px" @click="addColumn(scope.$index)"></span>
                                    <span class="el-icon-minus" style="cursor: pointer;font-size: 10px;padding-left: 5px" @click="minusColumn(scope.$index)"></span>
                                </template>
                            </el-table-column>
                            <el-table-column
                                    prop="code"
                                    label="原料编号"
                                    width="150">
                                <template scope="scope">
                                    <div class="relationship" style="position: relative">
                                        <!--<el-select v-model="scope.row.code" :disabled="$route.query.type==1" remote @change="codeChange(scope.$index)" filterable="" allow-create placeholder="输入内容" >
                                            <el-option v-for="item in material" :key="item.label" :label="item.value" :disabled="item.state.key!='NORMAL'" :value="item.label">
                                            </el-option>
                                        </el-select>-->
                                      <el-select class="codeNo" :class="'coderef_'+scope.$index" :ref="'coderef_'+scope.$index" v-model="scope.row.code" :disabled="isEdit"
                                                 remote @change="codeChange(scope.$index)"
                                                 :remote-method="remoteMethod" :loading="loading" @focus="codeFocus"
                                                 filterable="" placeholder="编号/条码/名称/简码"
                                                 @keyup.enter.native="codeEnter($event,scope.$index)">
                                        <el-option :disabled="true" value="0000" style="background-color: #409EFF;color: #fff;">
                                          <div style="width:600px;" >
                                            <el-row>
                                              <el-col :span="4">编号</el-col>
                                              <el-col :span="7">条码</el-col>
                                              <el-col :span="7">名称</el-col>
                                              <el-col :span="3">库存单位</el-col>
                                              <el-col :span="3">消耗单位</el-col>
                                            </el-row>
                                          </div>
                                        </el-option>
                                        <el-option v-for="(item,index) in material" :disabled="(item.state && item.state.key!='NORMAL')" :key="index"
                                                   :label="item.no" :value="item.no" >
                                          <div style="width:600px;border-bottom:1px solid #c0c0c0;padding:5px 0px">
                                            <!--{{item.value}}[{{item.purchaseUnit}}]-->
                                            <el-row>
                                              <el-col :span="4"><span v-if="item.no">{{item.no}}</span><span v-else>-</span></el-col>
                                              <el-col :span="7"><span v-if="item.goodcode">{{item.goodcode}}</span><span v-else>-</span></el-col>
                                              <el-col :span="7"><span v-if="item.name">{{item.name}}</span><span v-else>-</span></el-col>
                                              <el-col :span="3"><span v-if="item.unit">{{item.unit}}</span><span v-else>-</span></el-col>
                                              <el-col :span="3"><span v-if="item.consumeUnit">{{item.consumeUnit}}</span><span v-else>-</span></el-col>
                                            </el-row>
                                          </div>
                                        </el-option>
                                      </el-select>
                                        <span class="el-icon-more" @click="handleIconClick(scope.$index)"  style="cursor: pointer;font-size: 10px;padding-right: 5px; position: absolute;right: 10px;top: 40%"></span>
                                    </div>
                                </template>
                            </el-table-column>
                          <el-table-column
                            prop="goodcode"
                            label="条码">
                            <template  slot-scope="scope">
                              <el-tooltip class="item" effect="light" placement="bottom-start" v-if="scope.row.goodcodes && scope.row.goodcodes.length>1">
                                <div slot="content">所选品项含有多个条码:<br/>
                                  <div v-for="(item,index) in scope.row.goodcodes">
                                    <span>{{index+1}}、{{item}}</span>
                                  </div>
                                </div>
                                <el-button  type="text" style="padding-top: 0; padding-bottom: 0">{{scope.row.goodcode}}</el-button>
                              </el-tooltip>
                              <span v-else>{{scope.row.goodcode}}</span><br />
                            </template>
                          </el-table-column>
                            <el-table-column
                                    prop="name"
                                    label="原料名称"
                                    width="150" >
                            </el-table-column>
                            <el-table-column
                                    prop="goodsSpec"
                                    label="规格型号"
                                    width="150" >
                            </el-table-column>
                            <el-table-column
                                    prop="unit"
                                    label="库存单位">
                            </el-table-column>
                            <el-table-column
                                    prop="consumeUnit"
                                    label="消耗单位">
                            </el-table-column>
                            <el-table-column
                                    prop="count"
                                    label="消耗数量">
                                <template scope="scope">
                                    <el-input class="relationship " v-model="scope.row.count" :disabled="$route.query.type==1"
                                              @blur="priceValidate(scope.row,'count')"  @focus="printNum"
                                              :class="'focus_input_'+scope.$index" @keyup.enter.native="nextFocus(scope.$index,'')"
                                              placeholder="0.00"></el-input>
                                </template>
                            </el-table-column>
                        </el-table>
                    </div>
                </div>
            </el-form>
          <div class="myModel materialSelect">
          <el-dialog title="选择原料" :visible.sync="dialogTableVisible">
            <div style="margin-left: 10px;margin-right: 10px">
              <br />
                <el-row :gutter="20">
                  <el-col :span="8">
                    <el-input v-model="inputText" @keyup.enter.native="keyDown($event)" placeholder="原料编码/名称" size="medium"></el-input>
                  </el-col>
                  <el-col :span="12" style="text-align: left">
                    <el-button  class="btn-info" size="medium"  icon="el-icon-search" @click="inputClick">搜索</el-button>
                    <el-button  class="btn-warning"  size="medium" style="margin-left: 1px"  icon="el-icon-refresh" @click="cleanSearch">重置</el-button>
                  </el-col>
                </el-row>
              <el-row style="margin: 0; margin-top: 20px;">
                <el-col :span="4" style="padding-left: 0">
                  <div class="me_title">类别</div>
                  <el-tree
                  :data="data"
                  :props="defaultProps"
                  accordion
                  style="height:400px;overflow-y:auto"
                  node-key="id"
                  :default-expanded-keys="[2]"
                  :expand-on-click-node="false"
                  @node-click="handleNodeClick">
                </el-tree>
                </el-col>
                <el-col :span="20"  style="height:440px;overflow-y:auto; padding-left: 25px;">
                    <el-table :data="gridData"
                              border
                              max-height="400"
                              ref="multipleTable"
                              @cell-click="chnageGoodState"
                              @selection-change="handleSelectionChange">
                      <el-table-column
                        type="selection"
                        :selectable='checkboxInit'
                        width="55">
                      </el-table-column>
                      <el-table-column property="no" label="编号" width="85"></el-table-column>
                      <el-table-column
                        prop="goodcode"
                        label="条码">
                        <template  slot-scope="scope">
                          <el-tooltip class="item" effect="light" placement="bottom-start" v-if="scope.row.goodcodes && scope.row.goodcodes.length>1">
                            <div slot="content">所选品项含有多个条码:<br/>
                              <div v-for="(item,index) in scope.row.goodcodes">
                                <span>{{index+1}}、{{item}}</span>
                              </div>
                            </div>
                            <el-button  type="text" style="padding-top: 0; padding-bottom: 0">{{scope.row.goodcode}}</el-button>
                          </el-tooltip>
                          <span v-else>{{scope.row.goodcode}}</span><br />
                        </template>
                      </el-table-column>
                      <el-table-column property="name" label="名称"></el-table-column>
                      <el-table-column property="goodsSpec" label="规格" width="80"></el-table-column>
                      <el-table-column property="unit" label="库存单位" width="80"></el-table-column>
                      <el-table-column property="consumeUnit" label="消耗单位" width="80"></el-table-column>
                    </el-table>
                </el-col>
              </el-row>
              <br>
              <div class="block">
                <el-row>
                  <el-col :span="24" class="text-right">
                    <el-pagination
                      @size-change="handleSizeChange"
                      @current-change="handleCurrentChange"
                      :current-page.sync="currentPage3"
                      :page-sizes="pageSizes"
                      :page-size="pageSize"
                      layout="total, sizes, prev, pager, next, jumper"
                      :total="pageTotal">
                    </el-pagination>
                  </el-col>
                </el-row>
              </div>
            </div>
            <span slot="footer" class="dialog-footer">
                  <el-button @click="dialogTableVisible = false">取 消</el-button>
                  <el-button type="primary" @click="tableClick">确 定</el-button>
            </span>
          </el-dialog>
          </div>
        </div>
    </div>
</template>
<script>
    //注意路径
    export default{
        data(){
            return {
                dialogTableVisible:false,
                noEdit:true,
              pageSizes:window.pageSizes,//所有可选择的条数
              pageSize:window.pageSize,//控制一页显示的条数
                inputText:"",
                content:"",
                material:[],
                tableData: [{
                    id:"",
                    code: '',
                    name: '',
                    goodsSpec: '',
                    purchaseSpec: '',
                    consumeUnit:'',
                    count:'0',
                    memo:'',


                }],
                isEdit:false,
                modelForm: {},
                warehouses:[],
                product:{},
                restaurants: [],
                timeout:  null,
                selectRow:[],
                gridData: [],
                itemActive:0,
                data: [],
                defaultProps: {
                    children: 'children',
                    label: 'label'
                },
              currentPage3:1,
              pageTotal:0,
              query:"",
              loading:false,
              storeId: window.localStorage.getItem("dishKuId"),
            };
        },
        created(){
            window.this = this;
            this.initData();

        },
        methods: {
          nextFocus(index,name){
            if(name){
              $("."+name+index+" input").focus();
            }else {
              $(".coderef_"+(index+1)+" input").focus();

            }
          },
            //页面第一次进来获取表单需要的数据
            initData(){
                var id=this.$route.query.id;
                console.log(this.$route.query.id)
                this.$axios.get("dishes/machiningRelations/create?productId="+id).then((data)=>{
                    if(data.status==200){
                        var dataValue=data.content;
                        // this.modelForm=dataValue.machiningRelation;
                        this.product=dataValue.product;
                        var tree=dataValue.treeData;
                        this.newLabel(tree);
                        this.data=tree;
//                        this.material=dataValue.material;
                        this.tableData=[];
                         for(var i=0;i<dataValue.machiningRelation.length;i++){
                             for(var j=0;j<dataValue.material.length;j++){
                                 if(dataValue.machiningRelation[i].materialId==dataValue.material[j].label){

                                   if(dataValue.material[j].code && dataValue.material[j].code!=''){
                                     if(dataValue.material[j].code.indexOf(","+this.query+",")!=-1){
                                       dataValue.material[j].goodcode = this.query;
                                     }else {
                                       console.log(dataValue.material[j].code);
                                       console.log(dataValue.material[j].code.indexOf(",",2));
                                       dataValue.material[j].goodcode = dataValue.material[j].code.substring(1,dataValue.material[j].code.indexOf(",",2));
                                     }
                                     dataValue.material[j].code = dataValue.material[j].code.substring(1,dataValue.material[j].code.length-2);
                                     if(dataValue.material[j].code!=''){
                                       dataValue.material[j].goodcodes = dataValue.material[j].code.split(",");
                                     }
                                   }else{
                                     dataValue.material[j].goodcode="";
                                     dataValue.material[j].goodcodes=[];
                                   }

                                     this.tableData.push({
                                       id:dataValue.material[j].id,
                                       code: dataValue.material[j].no,
                                       name: dataValue.material[j].name,
                                       goodsSpec: dataValue.material[j].goodsSpec,
                                       count:dataValue.machiningRelation[i].count,
                                       consumeUnit:dataValue.material[j].consumeUnit,
                                       unit:dataValue.material[j].unit,
                                       goodcode:dataValue.material[j].goodcode,
                                       goodcodes:dataValue.material[j].goodcodes
                                     })
                                 }
                             }
                         }
                         console.log(this.tableData);

                    }else{
                        this.$message.error(data.body.message);
                    }
                })

            },
            getSumCost(item){
                if(this.modelForm.materialCost && this.modelForm.otherCost){
                    this.modelForm.cost=(this.modelForm.materialCost*1+this.modelForm.otherCost*1).toFixed(4);
                }else{
                    this.modelForm.cost=0.0
                }
            },

            inputClick(){
                this.selectGood("");
            },
          cleanSearch(){
            this.inputText = "";
          },
            newLabel(newList){
                if(newList){
                    for(var i=0;i<newList.length;i++){
                        newList[i].label=newList[i].name;
                        if(newList[i].children){
                            this.newLabel(newList[i].children)
                        }
                    }
                }
            },
            priceValidate(item,key) {
                var isNum = /^0$|^[1-9]\d{0,15}$|^[1-9]\d{0,15}\.{1}\d{1,4}$|^0\.{1}\d{1,4}$/g;
                if (!isNum.test(item[key])) {
                    item[key] = "0.00"
                } else {
                    item[key] = (item[key]*1).toFixed(2)
                }
            },
            handleCurrentChange(item){
                this.currentPage3=item
                this.selectGood(item);
            },
            printNum(){
                event.currentTarget.select();
            },
          codeEnter(e,index){
            if(e && e.target && e.target.value){
              this.$axios.get("branchstores/materialCosts/getMaterialsByName?storeId="+this.storeId+"&code="+e.target.value).then(data=>{
                this.loading = false;
                if(data.status==200){
                  this.material=data.content.materials;
                  this.$refs['coderef_'+index].blur();
                  if(e && this.material.length<=0){
                    e.target.select();
                    return;
                  }
                  this.codeForTable(index);
                  if(!this.tableData[index+1]){
                    this.addColumn(index);
                  }
                  this.material=[];
                  setTimeout(function () {
                    $(".focus_input_"+index+" input").focus();
                  },300);
                }
              });
            }else {
              return;
            }
          },
          codeForTable(index) {
            if(this.material && this.material.length>0){
              if(this.tableData && this.tableData.length>0){
                for (var m = 0; m < this.tableData.length; m++) {
                  if (m!=index && this.material[0].label == this.tableData[m].id) {
                    this.$message.info("您本次添加的["+this.tableData[m].code+"]品项含有重复");
                    break;
                  }
                }
              }
              this.tableData[index].name = this.material[0].name;
              this.tableData[index].id = this.material[0].id;
              this.tableData[index].name = this.material[0].name;
              this.tableData[index].goodcode = this.material[0].goodcode;
              this.tableData[index].goodcodes = this.material[0].goodcodes;
              this.tableData[index].code = this.material[0].no;
              this.tableData[index].purchaseSpec = this.material[0].goodsSpec; //规格型号
              this.tableData[index].spec = this.material[0].purchaseSpec; //采购规格
              this.tableData[index].unitName = this.material[0].purchaseUnit; //采购单位
              this.tableData[index].price = (this.material[0].purchasePrice * 1).toFixed(2);
              this.tableData[index].count = 0;
              this.tableData[index].money = (this.tableData[index].price * this.tableData[index].count).toFixed(2);
              this.tableData[index].purchaseNewPrice = this.material[0].purchaseNewPrice;
              this.tableData[index].unit = this.material[0].unit;
            }
            this.material=[];
          },
          codeFocus(){
            console.log("dddddddddddddddddd");
            this.material=[];
          },
            codeChange(index){
                for(var i=0;i<this.material.length;i++){
                    if(this.material[i].no===this.tableData[index].code){
                        console.log(this.material[i]);
                        this.tableData[index].code=this.material[i].no;
                        this.tableData[index].name=this.material[i].name;
                        this.tableData[index].id=this.material[i].id;
                        this.tableData[index].goodsSpec=this.material[i].goodsSpec;
                        this.tableData[index].consumeUnit=this.material[i].consumeUnit;
                        this.tableData[index].unit=this.material[i].unit;
                        this.tableData[index].count="0";
                      this.tableData[index].goodcode = this.material[i].goodcode;
                      this.tableData[index].goodcodes = this.material[i].goodcodes;
                    }
                }
            },
          remoteMethod(query) {
            if (query != '') {
              this.loading = true;
              this.$axios.get("branchstores/materialCosts/getMaterialsByName?storeId="+this.storeId+"&code="+query).then(data=>{
                this.loading = false;
                if(data.status==200){
                  this.material = data.content.materials;
                }
              });
            } else {
              this.material = [];
            }
          },
            selectGood(page){
                if(page==null || page==""){
                    page=1;
                }
                var params = "";
                if(this.inputText){
                    params += "&code="+this.inputText;
                }
                if(this.content){
                    params += "&categoryIds="+this.content;
                }

                this.$axios.get("dishes/machiningRelations/getMaterials?page.size="+this.pageSize+"&page.pn="+page+params).then((data)=>{
                    if(data.status==200){
                        var data=data.content;
                        this.gridData=data.materials.content;
                        this.pageTotal=data.materials.total;
                    }else{
                        this.$message.error("查询失败！");
                    }
                })
            },
            handleIconClick(index){
                if(this.isEdit) {
                    return;
                }
                this.dialogTableVisible = true;
                this.itemActive = index;
                this.selectGood("");

            },
            handleNodeClick(data) {
                var id=data.id;
                this.content=id;
                this.selectGood();
            },
            tableSelect(row){
                this.selectRow=row;

            },
            checkboxInit(row,index){
                if(row.state && row.state.key!="NORMAL"){
                    return 0;//不可勾选
                }else{
                    return 1;
                }
            },
            chnageGoodState(row, column, cell, event){
                if(row.state && row.state.key!="NORMAL"){
                    return;
                }else{
                }
                this.$refs.multipleTable.toggleRowSelection(row);
            },
            handleSelectionChange(row) {
                this.selectRow = row;
            },
            goBack() {
                this.router.go(-1);
            },
            submitForm(formName) {

                for (var i = 0; i < this.tableData.length; i++) {
                    if (this.tableData[i].id == "") {
                        if (this.tableData.length == 1) {
                            this.$message.error("请添加单据明细！");
                            return;
                        }
                        this.tableData.splice(i, 1);
                        i--;
                    }
                }
                if (this.tableData == null || this.tableData.length == 0) {
                    this.$message.error("请添加单据明细！");
                    return;
                }
                for (var i = 0; i < this.tableData.length; i++) {
                    if (this.tableData[i].count <= 0) {
                        this.$message.error("消耗数量不能小于0！请检查第"+(i+1)+"行数据");
                        return;
                    }
                }
                this.$refs[formName].validate((valid) => {
                    if (valid) {
                        var data = {};
                        data.productId = this.product.id;
                        data.items = this.tableData;
//                        data = JSON.stringify(data);
                        this.$axios.post("dishes/machiningRelations/create",data, 'json').then((data)=>{
                            if(data.status==200){
                                this.$message.success(data.message);
                                this.router.go(-1);
                            }else{
                                this.$message.error(data.message);
                            }
                        });
                    } else {
                        this.$message.error("请检查输入项");
                        return false;
                    }
                });
            },
            resetForm(formName) {
                this.$refs[formName].resetFields();
            },
            danjiaJiaoyan(item,key){
                if(key=="shuliang"){
                    var r = /^\+?[1-9][0-9]*$/;
                    if( ! r.test(item[key])){
                        item[key]="0.00"
                    }else{
                        item[key]=item[key]
                    }
                    return;
                }
                var isNum=/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/;
                if( ! isNum.test(item[key])){
                    item[key]="0.00"
                }else{
                    item[key]=item[key]
                }
            },
            addColumn(index){
                if(this.isEdit) {
                    return;
                }
                this.tableData.splice(index+1,0,{
                    id:"",
                    code: '',
                    name: '',
                    goodsSpec: '',
                    purchaseSpec: '',
                    consumeUnit:'',
                    count:'0',


                })
            },
            minusColumn(index){
                if(this.isEdit) {
                    return;
                }
                if(this.tableData.length>1){
                    this.tableData.splice(index,1);
                }else{
                    this.$message.info("最少保留一条");
                }
            },
            handleSelect(item) {

            },
            querySearchAsync(queryString, cb) {
                var restaurants = this.material;
                var results = queryString ? restaurants.filter(this.createStateFilter(queryString)) : restaurants;

                clearTimeout(this.timeout);
                this.timeout = setTimeout(() => {
                    cb(results);
                }, 3000 * Math.random());
            },
            createStateFilter(queryString) {
                return (state) => {
                    return (state.value.indexOf(queryString.toLowerCase()) === 0);
                };
            },
            toggleSelection(rows) {
                if (rows) {
                    rows.forEach(row => {
                        this.$refs.multipleTable.toggleRowSelection(row);
                    });
                } else {
                    this.$refs.multipleTable.clearSelection();
                }
            },
            handleSizeChange(val){
                this.pageSize=val;
                this.selectGood('');
            },
            tableClick(){
                this.dialogTableVisible = false;
                if(this.selectRow!=null && this.selectRow.length>0){
                    for(var i=this.selectRow.length-1;i>=0;i--) {
                        var isAdd=true;
                        for(var m=0;m<this.tableData.length;m++){
                            if(this.selectRow[i].id==this.tableData[m].id){
                                // isAdd=false;
                                this.$message.info("本次添加含有重复原料");
                                break;
                            }
                        }
                        if(isAdd) {

                            this.addColumn(this.itemActive);
                            this.tableData[this.itemActive + 1].code = this.selectRow[i].no+ this.selectRow[i].name;;
                            this.tableData[this.itemActive + 1].name = this.selectRow[i].name;
                            this.tableData[this.itemActive + 1].id = this.selectRow[i].id;
                            this.tableData[this.itemActive + 1].goodsSpec = this.selectRow[i].goodsSpec;
                            this.tableData[this.itemActive + 1].consumeUnit = this.selectRow[i].consumeUnit;
                            this.tableData[this.itemActive + 1].unit = this.selectRow[i].unit;
                            this.tableData[this.itemActive + 1].orderPriceBom = this.selectRow[i].orderPriceBom;
                            this.tableData[this.itemActive + 1].count="0";
                            this.tableData[this.itemActive + 1].price="0.00";
                            this.tableData[this.itemActive + 1].newPrice="0.00";
                            this.tableData[this.itemActive + 1].purchaseNewPrice=this.selectRow[i].purchaseNewPrice;
                            this.tableData[this.itemActive + 1].consumeRates=this.selectRow[i].consumeRates;
                        }
                    }
                    if(this.tableData[this.itemActive].id==""){
                        this.tableData.splice(this.itemActive, 1);
                    }

                }

            },
            isDouble(item,key){
                var isNum=/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/;
                if( ! isNum.test(item[key])){
                    item[key]="0.00"
                }else{
                    item[key]=item[key]
                }
            }
        },

    }
</script>
<style scoped>
    .el-form-item{
        margin-bottom: 10px !important;
    }
    .el-table tr{
        border-bottom: 1px solid #dfe6ec !important;
    }
    .me_title{
      padding: 10px;
      background-color: #eef1f6;
      border: 1px solid #dfe6ec;
      border-bottom: 0;
      text-align: left;
    }
</style>
